Skip to content

fix: preserve request extensions on x402 retry#4

Merged
gitctrlx merged 1 commit intoqntx:mainfrom
shuofengzhang:fix/preserve-request-extensions
Mar 16, 2026
Merged

fix: preserve request extensions on x402 retry#4
gitctrlx merged 1 commit intoqntx:mainfrom
shuofengzhang:fix/preserve-request-extensions

Conversation

@shuofengzhang
Copy link
Contributor

What changed

  • Preserve httpx.Request.extensions when cloning a request for x402 retry headers in _clone_request_with_headers.
  • Add transport unit tests to verify:
    • retry header merging/overrides behave correctly
    • request extensions are preserved in the cloned retry request

Why

  • httpx stores per-request metadata (for example timeout settings) in Request.extensions.
  • The retry clone previously rebuilt a request without copying extensions, which could drop request-level metadata on the paid retry.
  • Preserving extensions keeps retry behavior consistent with the original request while remaining fully backward-compatible.

Testing

  • scripts/clone_and_test.sh qntx/x402-openai-python (pass)
  • source .venv/bin/activate && pytest -q (25 passed)

@gitctrlx gitctrlx merged commit 66db9c8 into qntx:main Mar 16, 2026
1 check passed
@gitctrlx
Copy link
Contributor

Great fix — this looks accurate and valuable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants